function* gen() { 
  
  var data=  yield step1();
  
    step2(data);
    
}

function step1() {
    	var params = {
			"code": "086"
		};
		$.ajax({
			type: "get",
			url: 'https://www.bus365.com/parameters/0',
			async: true,
			dataType: "json",
			data: params

		}).done(function (data) {
            //console.log(data);
           iterator.next(data);

		}).fail(function (res) {
            console.log(res);
             iterator.next(res);

		});
      
}
function step2(data) {
    
     console.log(data);
}

let iterator = gen()
iterator.next("1");



